npm-install-package
Install an npm package.
Installation
$ npm install npm-install-package
Usage
const npmInstallPackage = require('npm-install-package')
npmInstallPackage('cliclopts', opts, err => {
if (err) throw err
})
With multiple installs, offline-first fetching and saving to dev dependencies:
const npmInstallPackage = require('npm-install-package')
const devDeps = [ 'map-limit', 'minimist', 'cliclopts' ]
const opts = { saveDev: true, cache: true }
npmInstallPackage(devDeps, opts, err => {
if (err) throw err
})
API
npmInstallPackage(dependencies, options, cb)
Install an array of dependencies. Opts can contain the following values:
- save: save a value to
dependencies
. Defaults to false
- saveDev: save a value to
devDependencies
. Defaults to false
- cache: attempt to get packages from the local cache first. Defaults to
false
- silent: install packages silently without writing to stdout. Defaults to
false
License
MIT